package org.vectrics.user;

import java.util.Comparator;

public class UserPrivilegeTypeSortByGroupComparator implements Comparator {

	public UserPrivilegeTypeSortByGroupComparator() {
		super();
	}

	public int compare(Object o1, Object o2) {
		int result = 0;
		UserPrivilegeType role1 = (UserPrivilegeType)o1;
		UserPrivilegeType role2 = (UserPrivilegeType)o2;
		
		result = role1.getUserPrivilegeTypeGroup().getCode().compareTo(role2.getUserPrivilegeTypeGroup().getCode());
		if (result == 0)
			result = role1.getCode().compareTo(role2.getCode());
		return result;
	}

}
